var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Person = /** @class */ (function () {
    function Person(name, age) {
        this.name = name;
        this.age = age;
    }
    Person.prototype.sayHello = function () {
        console.log("Hello, my name is ".concat(this.name, " and I am ").concat(this.age, " years old."));
    };
    return Person;
}());
var Teacher = /** @class */ (function (_super) {
    __extends(Teacher, _super);
    function Teacher(name, age, subject) {
        var _this = _super.call(this, name, age) || this;
        _this.subject = subject;
        return _this;
    }
    Teacher.prototype.sayHello = function () {
        console.log("Hello, my name is ".concat(this.name, " and I am ").concat(this.age, " years old. I teach ").concat(this.subject, "."));
    };
    Teacher.prototype.dance = function () {
        console.log('I am dancing!');
    };
    Teacher.prototype.caiyi = function () {
        console.log('I am caiyi!');
    };
    return Teacher;
}(Person));
var Student = /** @class */ (function (_super) {
    __extends(Student, _super);
    function Student(id, name, age) {
        var _this = _super.call(this, name, age) || this;
        _this.id = id;
        return _this;
    }
    Student.prototype.sayHello = function () {
        console.log("Hello,my id is ".concat(this.id, "  name is ").concat(this.name, " and I am ").concat(this.age, " years old."));
    }; //super关键字用于调用父类的构造函数，必须在子类的构造函数中调用
    Student.prototype.dance = function () {
        console.log('I am dancing!');
    };
    return Student;
}(Person));
var stu1 = new Student(1, 'John', 30);
stu1.sayHello(); // Hello, my name is John and I am 30 years old.
stu1.dance(); // I am dancing!
var teacher1 = new Teacher('Jane', 40, 'Math');
teacher1.sayHello(); // Hello, my name is Jane and I am 40 years old. I teach Math.
teacher1.dance(); // I am dancing!
teacher1.caiyi(); // I am caiyi!
